home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / lang / SmallEiffel.lha / SmallEiffel / lib_show / bench2 / bench.e < prev    next >
Text File  |  1998-12-22  |  2KB  |  80 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. deferred class BENCH
  17.    --
  18.    -- Comparison :  ARRAY, FIXED_ARRAY, LINK_LIST and LINK2_LIST.
  19.    --
  20.  
  21. feature
  22.  
  23.    -- According to the power of your computer, set `tuning'
  24.    -- to a good positive value. Default is for very small 
  25.    -- computer :
  26.    tuning: INTEGER is 1; -- 500000; 
  27.  
  28. feature {NONE}
  29.    
  30.    cltn: COLLECTION[INTEGER] is
  31.       deferred
  32.       end;
  33.  
  34.    count: INTEGER is
  35.       do
  36.      Result := 1 + tuning;
  37.       end;
  38.  
  39.    frozen bench is
  40.       require
  41.      cltn.count = count
  42.       do
  43.      increment(cltn,1);
  44.      increment(cltn,1);
  45.      increment(cltn,-2);
  46.      check_all(cltn,0);
  47.       end;
  48.  
  49.    increment(c: like cltn; value: INTEGER) is
  50.       local
  51.      i: INTEGER;
  52.       do
  53.      from
  54.         i := c.upper;
  55.      until
  56.         i = c.lower
  57.      loop
  58.         c.put(c.item(i-1),i);
  59.         i := i - 1;
  60.      end;
  61.       end;
  62.  
  63.    check_all(c: like cltn; value: DOUBLE) is
  64.       local
  65.      i: INTEGER;
  66.       do
  67.      from
  68.         i := c.upper;
  69.      until
  70.         i = c.lower
  71.      loop
  72.         if c.item(i) /= value then
  73.            std_output.put_string("Error in bench.%N");
  74.         end;
  75.         i := i - 1;
  76.      end;
  77.       end;
  78.  
  79. end -- BENCH
  80.